bitkeeper revision 1.1370 (4269298fN8pBqkwEJEdXf9MR8bXVzA)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 22 Apr 2005 16:42:55 +0000 (16:42 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 22 Apr 2005 16:42:55 +0000 (16:42 +0000)
Add a headroom check to MMUEXT_REASSIGN_PAGE.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/mm.c

index 3caac3d1679430e32fdf6f31bdcb8e5ae23e3ca1..82b3ab1fcd6bc9c28674efd27f2da4b9139d39d6 100644 (file)
@@ -1686,11 +1686,19 @@ int do_mmuext_op(
                 spin_lock(&d->page_alloc_lock);
             }
             
-            /* A domain shouldn't have PGC_allocated pages when it is dying. */
+            /*
+             * Check that 'e' will accept the page and has reservation
+             * headroom. Also, a domain mustn't have PGC_allocated pages when
+             * it is dying. 
+             */
+            ASSERT(e->tot_pages <= e->max_pages);
             if ( unlikely(test_bit(DF_DYING, &e->d_flags)) ||
+                 unlikely(e->tot_pages == e->max_pages) ||
                  unlikely(IS_XEN_HEAP_FRAME(page)) )
             {
-                MEM_LOG("Reassign page is Xen heap, or dest dom is dying.");
+                MEM_LOG("Transferee has no reservation headroom (%d,%d), or "
+                        "page is in Xen heap (%p), or dom is dying (%d).\n",
+                        e->tot_pages, e->max_pages, op.mfn, e->d_flags);
                 okay = 0;
                 goto reassign_fail;
             }